import { WAYBILL_LIST, WAYBILL_DETAILS, WAYBILL_CAR_DETAILS, WAYBILL_TIMELINE, WAYBILL_TAB_STASTIC, RELATE_ORDER_LIST } from './api'
import { METHOD, request } from '@/utils/request'

/**
 * 获取运单表格列表
 * @param params 运单列表参数
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getAllWaybillList(params) {
  return request(WAYBILL_LIST, METHOD.POST, params)
}

/**
 * 获取运单详情页-静态运单信息
 * @param code 运单码
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getWaybillDetails(code) {
  return request(`${WAYBILL_DETAILS}/${code}`, METHOD.GET)
}

/**
 * 获取运单静态承运信息
 * @param code 运单码
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getCarDetails(code) {
  return request(`${WAYBILL_CAR_DETAILS}/${code}`, METHOD.GET)
}

/**
 * 获取时间轴信息
 * @param code 运单码
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getTimeLineInfo(code) {
  return request(`${WAYBILL_TIMELINE}/${code}`, METHOD.GET)
}

/**
 * 获取tab分组统计
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getTabStatistics(params) {
  return request(WAYBILL_TAB_STASTIC, METHOD.POST, params)
}

/**
 * 查询关联订单列表
 * @param code 运单编号
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getRelateOrderList(code) {
  return request(`${RELATE_ORDER_LIST}/${code}`, METHOD.GET)
}
